<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
    <script src="/public/js/index.js"></script>
  </head>
  <body>
    <h1>首页</h1>

    {% if userInfo._id %}
    <h2>用户信息：</h2>
    <div>
      <p class="userInfo">{{ userInfo.username }}</p>
      {% if userInfo.isAdmin %}
      <p class="userInfo">欢迎管理员！<a href="/admin">前往管理后台</a></p>
      {% else %}
      <p class="userInfo">欢迎光临我的博客！</p>
      {% endif %} <button class="signOut">退出</button>
    </div>
    {% else %}
    <h2>登录模块</h2>
    <div>
      <div><span>用户名：</span> <input type="text" class="username" /></div>
      <div><span>密码：</span> <input type="password" class="password" /></div>
      <div><button class="signIn">登录</button></div>
    </div>
    {% endif %}
    <h2>注册模块</h2>
    <div>
      <input type="text" class="username" />
      <input type="password" class="password" />
      <input type="password" class="repassword" />
      <button class="signUp">注册</button>
    </div>
  </body>
</html>
